package com.springframework;

import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

/**
 * Bean 工厂
 *
 * @author xuhui
 */
public class BeanFactory {

    private Map<String,BeanDefinition> beanDefinitionMap = new ConcurrentHashMap<>();


    public Object getBean(String name){
        return beanDefinitionMap.get(name).getBean();
    }
    /**
     * bean注册
     * @param name
     * @param beanDefinition
     */
    public void registerBeanDefinition(String name,BeanDefinition beanDefinition){
        beanDefinitionMap.put(name,beanDefinition);
    }
}
